<template>
  <el-table class="elTable summaryTable" :data="data" v-loading="loading" ref="table2Ref" element-loading-text="加载中..."
    :span-method="spanMethod" :show-header="false">
    <el-table-column label="填报区县占比" align="right" width="300" fixed="left">
      <el-table-column label="填报区县数" width="300">
        <el-table-column label="省" width="150" prop="province" align="center">
        </el-table-column>
        <el-table-column label="区县总个数" width="150" align="center" prop="countyNum">
        </el-table-column>
      </el-table-column>
    </el-table-column>
    <el-table-column label="空间数据" align="center">
      <el-table-column label="行政区划" align="center" prop="divisionProportion">
        <el-table-column prop="divisionNum" align="center"></el-table-column>
        <el-table-column prop="divisionProportion" align="center">
          <template #default="scope">
            {{ scope.row.divisionProportion }}%
          </template>
        </el-table-column>
      </el-table-column>
      <el-table-column label="高程" align="center" prop="heightProportion">
        <el-table-column prop="heightNum" align="center"></el-table-column>
        <el-table-column prop="heightProportion" align="center">
          <template #default="scope">
            {{ scope.row.heightProportion }}%
          </template>
        </el-table-column>
      </el-table-column>
      <el-table-column label="坡度" align="center" prop="slopeProportion">
        <el-table-column prop="slopeNum" align="center"></el-table-column>
        <el-table-column prop="slopeProportion" align="center">
          <template #default="scope">
            {{ scope.row.slopeProportion }}%
          </template></el-table-column>
      </el-table-column>
      <el-table-column label="人口建筑物经济公里格网" width="100" prop="gridProportion" align="center">
        <el-table-column prop="gridNum" align="center"></el-table-column>
        <el-table-column prop="gridProportion" align="center">
          <template #default="scope">
            {{ scope.row.gridProportion }}%
          </template>
        </el-table-column>
      </el-table-column>
      <el-table-column label="道路" align="center" prop="roadProportion">
        <el-table-column prop="roadNum" align="center"></el-table-column>
        <el-table-column prop="roadProportion" align="center">
          <template #default="scope">
            {{ scope.row.roadProportion }}%
          </template>
        </el-table-column>
      </el-table-column>
      <el-table-column label="机场" align="center" prop="airportProportion">
        <el-table-column prop="airportNum" align="center"></el-table-column>
        <el-table-column prop="airportProportion" align="center">
          <template #default="scope">
            {{ scope.row.airportProportion }}%
          </template></el-table-column>
      </el-table-column>
      <el-table-column label="水库" align="center" prop="reservoirProportion">
        <el-table-column prop="reservoirNum" align="center"></el-table-column>
        <el-table-column prop="reservoirProportion" align="center">
          <template #default="scope">
            {{ scope.row.reservoirProportion }}%
          </template>
        </el-table-column>
      </el-table-column>
      <el-table-column label="学校" align="center" prop="schoolProportion">
        <el-table-column prop="schoolNum" align="center"></el-table-column>
        <el-table-column prop="schoolProportion" align="center">
          <template #default="scope">
            {{ scope.row.schoolProportion }}%
          </template>
        </el-table-column>
      </el-table-column>
      <el-table-column label="医院" align="center" prop="hospitalProportion">
        <el-table-column prop="hospitalNum" align="center"></el-table-column>
        <el-table-column prop="hospitalProportion" align="center">
          <template #default="scope">
            {{ scope.row.hospitalProportion }}%
          </template>
        </el-table-column>
      </el-table-column>
      <el-table-column label="地质灾害" align="center" prop="dzzhProportion">
        <el-table-column prop="dzzhNum" align="center"></el-table-column>
        <el-table-column prop="dzzhProportion" align="center">
          <template #default="scope">
            {{ scope.row.dzzhProportion }}%
          </template>
        </el-table-column>
      </el-table-column>
      <el-table-column label="活动断层" align="center" prop="hddcProportion">
        <el-table-column prop="hddcNum" align="center"></el-table-column>
        <el-table-column prop="hddcProportion" align="center">
          <template #default="scope">
            {{ scope.row.hddcProportion }}%
          </template>
        </el-table-column>
      </el-table-column>
      <el-table-column label="危化企业" align="center" prop="dangerousProportion">
        <el-table-column prop="dangerousNum" align="center"></el-table-column>
        <el-table-column prop="dangerousProportion" align="center">
          <template #default="scope">
            {{ scope.row.dangerousProportion }}%
          </template></el-table-column>
      </el-table-column>
      <el-table-column label="加油（加气）站" width="100" align="center" prop="gasProportion">
        <el-table-column prop="gasNum" align="center"></el-table-column>
        <el-table-column prop="gasProportion" align="center">
          <template #default="scope">
            {{ scope.row.gasProportion }}%
          </template>
        </el-table-column>
      </el-table-column>
      <el-table-column label="应急避难场所" align="center" prop="emergencyProportion">
        <el-table-column prop="emergencyNum" align="center"></el-table-column>
        <el-table-column prop="emergencyProportion" align="center">
          <template #default="scope">
            {{ scope.row.emergencyProportion }}%
          </template></el-table-column>
      </el-table-column>
      <el-table-column label="基于遥感的房屋抗震能力初步评估数据" width="120" align="center" prop="rsProportion">
        <el-table-column prop="rsNum" align="center"></el-table-column>
        <el-table-column prop="rsProportion" align="center">
          <template #default="scope">
            {{ scope.row.rsProportion }}%
          </template>
        </el-table-column>
      </el-table-column>
    </el-table-column>
    <el-table-column label="统计数据" align="center">
      <el-table-column label="历史地震信息" width="100" align="center" prop="informationProportion">
        <el-table-column prop="informationNum" align="center"></el-table-column>
        <el-table-column prop="informationProportion" align="center">
          <template #default="scope">
            {{ scope.row.informationProportion }}%
          </template></el-table-column>
      </el-table-column>
      <el-table-column label="历史地震灾害信息" width="100" align="center" prop="disasterProportion">
        <el-table-column prop="disasterNum" align="center"></el-table-column>
        <el-table-column prop="disasterProportion" align="center">
          <template #default="scope">
            {{ scope.row.disasterProportion }}%
          </template></el-table-column>
      </el-table-column>
      <el-table-column label="历史预评估数据" width="100" align="center" prop="preAppraisalProportion">
        <el-table-column prop="preAppraisalNum" align="center"></el-table-column>
        <el-table-column prop="preAppraisalProportion" align="center">
          <template #default="scope">
            {{ scope.row.preAppraisalProportion }}%
          </template></el-table-column></el-table-column>
      <el-table-column label="区县综合概况信息" width="100" align="center" prop="districtInProportion">
        <el-table-column prop="districtInNum" align="center"></el-table-column>
        <el-table-column prop="districtInProportion" align="center">
          <template #default="scope">
            {{ scope.row.districtInProportion }}%
          </template></el-table-column></el-table-column>
      <el-table-column label="乡镇综合概况信息" width="100" align="center" prop="townshipInProportion">
        <el-table-column prop="townshipInNum" align="center"></el-table-column>
        <el-table-column prop="townshipInProportion" align="center">
          <template #default="scope">
            {{ scope.row.townshipInProportion }}%
          </template></el-table-column></el-table-column>
      <el-table-column label="区县人口和建筑物概况" width="100" align="center" prop="districtPoProportion">
        <el-table-column prop="districtPoNum" align="center"></el-table-column>
        <el-table-column prop="districtPoProportion" align="center">
          <template #default="scope">
            {{ scope.row.districtPoProportion }}%
          </template></el-table-column></el-table-column>
      <el-table-column label="乡镇人口和建筑物概况" width="100" align="center" prop="townshipPoProportion">
        <el-table-column prop="townshipPoNum" align="center"></el-table-column>
        <el-table-column prop="townshipPoProportion" align="center">
          <template #default="scope">
            {{ scope.row.townshipPoProportion }}%
          </template></el-table-column></el-table-column>
      <el-table-column label="人口普查数据" width="100" align="center" prop="populationCensusProportion">
        <el-table-column prop="populationCensusNum" align="center"></el-table-column>
        <el-table-column prop="populationCensusProportion" align="center">
          <template #default="scope">
            {{ scope.row.populationCensusProportion }}%
          </template>
        </el-table-column></el-table-column>
      <el-table-column label="建筑物易损性数据" width="100" align="center" prop="buildingProportion">
        <el-table-column prop="buildingNum" align="center"></el-table-column>
        <el-table-column prop="buildingProportion" align="center">
          <template #default="scope">
            {{ scope.row.buildingProportion }}%
          </template>
        </el-table-column></el-table-column>
      <el-table-column label="房屋造价数据" width="100" align="center" prop="houseProportion">
        <el-table-column prop="houseNum" align="center"></el-table-column>
        <el-table-column prop="houseProportion" align="center">
          <template #default="scope">
            {{ scope.row.houseProportion }}%
          </template>
        </el-table-column></el-table-column>
      <el-table-column label="重大工程基础设施" width="100" align="center" prop="projectProportion">
        <el-table-column prop="projectNum" align="center"></el-table-column>
        <el-table-column prop="projectProportion" align="center">
          <template #default="scope">
            {{ scope.row.projectProportion }}%
          </template></el-table-column></el-table-column>
      <el-table-column label="GDP数据" width="100" align="center" prop="gdpProportion">
        <el-table-column prop="gdpNum" align="center"></el-table-column>
        <el-table-column prop="gdpProportion" align="center">
          <template #default="scope">
            {{ scope.row.gdpProportion }}%
          </template></el-table-column></el-table-column>
      <el-table-column label="应急准备情况" width="100" align="center" prop="contingencyProportion">
        <el-table-column prop="contingencyNum" align="center"></el-table-column>
        <el-table-column prop="contingencyProportion" align="center">
          <template #default="scope">
            {{ scope.row.contingencyProportion }}%
          </template></el-table-column></el-table-column>
    </el-table-column>
    <el-table-column label="现场调查数据" align="center">
      <el-table-column label="建筑物单体数据" width="90" align="center" prop="buildingsUnitProportion">
        <el-table-column prop="buildingsUnitNum" align="center"></el-table-column>
        <el-table-column prop="buildingsUnitProportion" align="center">
          <template #default="scope">
            {{ scope.row.buildingsUnitProportion }}%
          </template></el-table-column>
      </el-table-column>
      <el-table-column label="抽样调查点概况信息" width="90" align="center" prop="surveyPointProportion">
        <el-table-column prop="surveyPointNum" align="center"></el-table-column>
        <el-table-column prop="surveyPointProportion" align="center">
          <template #default="scope">
            {{ scope.row.surveyPointProportion }}%
          </template></el-table-column></el-table-column>
      <el-table-column label="灾害风险点信息" width="90" align="center" porp="riskPointProportion">
        <el-table-column prop="riskPointNum" align="center"></el-table-column>
        <el-table-column prop="riskPointProportion" align="center">
          <template #default="scope">
            {{ scope.row.riskPointProportion }}%
          </template></el-table-column></el-table-column>
      <el-table-column label="区县致死性差异指标" width="90" align="center" prop="fatalProportion">
        <el-table-column prop="fatalNum" align="center"></el-table-column>
        <el-table-column prop="fatalProportion" align="center">
          <template #default="scope">
            {{ scope.row.fatalProportion }}%
          </template></el-table-column></el-table-column>
    </el-table-column>
  </el-table>
</template>
<script setup>
defineProps({
  data: Array,
  loading: Boolean
})
const table2Ref = ref(null)
// 合并表格列
const spanMethod = ({ row, column, rowIndex, columnIndex }) => {
  if (row.province == "数据条数合计") {
    if (columnIndex !== 0 && columnIndex !== 1) {
      if (columnIndex % 2 == 0) {
        return [1, 2];
      }
      if (columnIndex % 2 == 1) {
        return [0, 0];
      }
    }
  }
};

defineExpose({
  table2Ref
})
</script>
<style lang="scss" scoped>
.summaryTable {
  border-top: none !important;
  :deep(.el-table__inner-wrapper) {
    tr>td.el-table__cell:last-child {
      border-right: none !important;
    }
  }
}
</style>